package test2.recursionAndSort;

public class Solution {

    public int[] sortArrayByParityII(int[] A) {
        // 在此处写入代码
        int[] B = new int[A.length];
        int index1 = 1;
        int index2 = 0;

        for(int a: A) {
            if (a % 2 == 1) {
                B[index1] = a;
                index1 += 2;
            } else {
                B[index2] = a;
                index2 += 2;
            }
        }

        return B;

    }
}
